<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>
  <script>
    // for循环 每个位数 进行对比
    var queryString = function (S, N) {
      for (let i = 1; i <= N; i++) {
        if (S.indexOf(i.toString(2)) === -1) {
          return false
        }
      }
      return true
    }
    console.log(queryString(s = "0110", n = 3))
  </script>
</body>

</html>